package com.qumitech.visualnovel.datasource.editor;

import java.util.*;
import org.apache.ibatis.annotations.*;
import com.qumitech.visualnovel.model.dto.BookQueryDTO;
import com.qumitech.visualnovel.model.dto.ReviewQueryDTO;
import com.qumitech.visualnovel.model.dao.editor.BookDAO;

public interface BookDAOMapper {
    int deleteByPrimaryKey(Long id);

    int insert(BookDAO record);

    int insertSelective(BookDAO record);

    BookDAO selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(BookDAO record);

    int updateByPrimaryKey(BookDAO record);

    int getEditStateNum(@Param("uid") Integer uid, @Param("editState") String editState);

    String getAuthorName(Long bookId);

    int total(BookQueryDTO param);

    List<BookDAO> list(BookQueryDTO param);

    int publishTotal(ReviewQueryDTO param);

    List<BookDAO> publishList(ReviewQueryDTO param);

    int dashboardTotal(
        @Param("publishState") String publishState,
        @Param("reviewState") String reviewState);

    List<BookDAO> dashboardList(
        @Param("publishState") String publishState,
        @Param("reviewState") String reviewState,
        @Param("offset") Integer offset,
        @Param("limit") Integer limit);

    List<Map<Long, String>> getBookNameOption(@Param("publishStates") List<String> publishStates, @Param("category") String category);

    @MapKey("id")
    Map<Long, BookDAO> getBookMapByTitle(@Param("title") String title);

    @MapKey("id")
    Map<Long, BookDAO> getBookMapByIds(@Param("bookIds") Set bookIds);

    List<Long> getBookIdsByCategory(@Param("category") String category);

    List<BookDAO> queryByPublishState(@Param("publishState") String publishState);
}